<?php
/**
 * Created by PhpStorm.
 * User: hg116
 * Date: 2018/12/5
 * Time: 23:47
 */

include "config.php";




//4.准备sql语句

if($_SERVER["REQUEST_METHOD"]=="POST"){
    if (isset($_REQUEST["val"])){
        $val = $_REQUEST["val"];
        $sql = "SELECT * FROM `uphone` WHERE u_pname='".$val."';";




        $result=$conn->query($sql);

        if($result->num_rows>=1){
            print_r(json_encode(array("msg"=>"邮箱已存在","status"=>"0")));
        }else{
            print_r(json_encode(array("status"=>"1")));
        }
//关闭数据库
        $conn->close();
    }else{
        print_r("不能为空");
    }
}else{
    print_r("不支持get请求");
}


